home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Development / Source / Macintosh Tracker 1.1 Source / Tracker Server Folder / mac_hack.h < prev    next >
Text File  |  1993-07-07  |  6KB  |  246 lines

  1. /* mac_hack.h */
  2.  
  3. #pragma once
  4.  
  5. /* All the stuff in this file was written by Thomas R. Lawrence. */
  6. /* See the "mac_readme" or "mac_programmer_info" files for more information */
  7. /* about the Macintosh port */
  8.  
  9. #include <stdio.h>
  10. #include <stdlib.h>
  11. #include <string.h>
  12. #include <ctype.h>
  13. #include <math.h>
  14. #include <unix.h>
  15.  
  16. /********************************************************************************/
  17. /* High-level hackery */
  18.  
  19.  
  20. int MYprintf(...);
  21. #define printf MYprintf
  22.  
  23. int MYfprintf(...);
  24. #define fprintf MYfprintf
  25.  
  26.  
  27. /* note: this structure supports reading only.  There is no copyback of dirty info */
  28. #define FILEBUFFERSIZE (4096)
  29. typedef struct
  30.     {
  31.         short            MacFileHandle;
  32.         short            BufPtr;
  33.         long            Index;
  34.         long            EndOfFile;
  35.         char            Buffer[FILEBUFFERSIZE];
  36.     } MyFILE;
  37.  
  38. #define FILE MyFILE
  39.  
  40. int MYfgetc(FILE* FileToGetFrom);
  41. #define fgetc(FileToGetFrom)\
  42. (((FileToGetFrom->BufPtr != FILEBUFFERSIZE)\
  43.     && (FileToGetFrom->Index < FileToGetFrom->EndOfFile))\
  44. ?\
  45.     (\
  46.         FileToGetFrom->BufPtr += 1,\
  47.         FileToGetFrom->Index += 1,\
  48.         (int)(unsigned char)FileToGetFrom->Buffer[FileToGetFrom->BufPtr - 1]\
  49.     )\
  50. :\
  51.     (MYfgetc(FileToGetFrom)))
  52.  
  53. int MYfputc(int CharToPut, FILE *FileToPutTo);
  54. #define fputc MYfputc
  55.  
  56. FILE* MYfopen(char* FileName, char* Mode);
  57. #define fopen MYfopen
  58.  
  59. int MYfclose(FILE* FileToClose);
  60. #define fclose MYfclose
  61.  
  62. int MYfread(char* PlaceToPut, int SizeOfElement, int NumElements, FILE* TheFile);
  63. #define fread MYfread
  64.  
  65. void* MYmalloc(long SizeOfBlock);
  66. #define malloc MYmalloc
  67.  
  68. void MYfree(void* Block);
  69. #define free MYfree
  70.  
  71. /* to allow for my own antialiasing-friendly readin routine */
  72. void *MYcalloc(size_t NumThings, size_t SizeOfThing);
  73. #define calloc MYcalloc
  74.  
  75. #define fflush(stupid)
  76.  
  77. void MYexit(int Value);
  78. #define exit MYexit
  79.  
  80. char* MYgetenv(char* MeaninglessParameter);
  81. #define getenv MYgetenv
  82.  
  83. void MYperror(char* ErrorMessage);
  84. #define perror MYperror
  85.  
  86. void MYputs(char* Message);
  87. #define puts MYputs
  88.  
  89. #undef putchar
  90. #define putchar(thang)
  91.  
  92. #undef getchar
  93. #define getchar(thang)
  94.  
  95. #undef stdin
  96. #define stdin NULL
  97. #undef stdout
  98. #define stdout NULL
  99. #undef stderr
  100. #define stderr NULL
  101.  
  102. #undef isalnum
  103. #define isalnum(x) 0
  104. #undef isalpha
  105. #define isalpha(x) 0
  106. #undef iscntrl
  107. #define iscntrl(x) 0
  108. #undef isdigit
  109. #define isdigit(x) 0
  110. #undef isgraph
  111. #define isgraph(x) 0
  112. #undef islower
  113. #define islower(x) 0
  114. #undef isprint
  115. #define isprint(x) 0
  116. #undef ispunct
  117. #define ispunct(x) 0
  118. #undef isspace
  119. #define isspace(x) 0
  120. #undef isupper
  121. #define isupper(x) 0
  122. #undef isxdigit
  123. #define isxdigit(x) 0
  124.  
  125. #define NDEBUG /* for assert */
  126.  
  127. long double MYfloor(long double Base);
  128. #define floor MYfloor
  129.  
  130. long double MYpow(long double Base, long double Exponent);
  131. #define pow MYpow
  132.  
  133.  
  134. /********************************************************************************/
  135.  
  136.  
  137.  
  138. #include "defs.h"
  139.  
  140. #undef LOCAL
  141.  
  142. #undef NULL
  143. #define NULL (0L)
  144.  
  145. /* prototypes */
  146.  
  147.  
  148. /* altered_audio.c */
  149. void init_tables(int oversample, int frequency, struct channel* chan);
  150. void reset_note(struct channel *ch, int note, int pitch);
  151. void set_current_pitch(struct channel *ch, int pitch);
  152. void set_current_volume(struct channel *ch, int volume);
  153.  
  154. /* automaton.c */
  155. void init_automaton(struct automaton *a, struct song *song, int start, BOOL s);
  156. void next_tick(struct automaton *a);
  157.  
  158. /* commands.c */
  159. void do_nothing(struct channel *ch);
  160. void do_slide(struct channel *ch);
  161. void do_vibrato(struct channel *ch);
  162. void do_arpeggio(struct channel *ch);
  163. void do_slidevol(struct channel *ch);
  164. void do_retrig(struct channel *ch);
  165. void do_latestart(struct channel *ch);
  166. void do_cut(struct channel *ch);
  167. void do_portamento(struct channel *ch);
  168. void do_portaslide(struct channel *ch);
  169. void do_vibratoslide(struct channel *ch);
  170. void set_nothing(struct automaton *a, struct channel *ch);
  171. void set_upslide(struct automaton *a, struct channel *ch);
  172. void set_downslide(struct automaton *a, struct channel *ch);
  173. void set_vibrato(struct automaton *a, struct channel *ch);
  174. void set_arpeggio(struct automaton *a, struct channel *ch);
  175. void set_slidevol(struct automaton *a, struct channel *ch);
  176. void set_extended(struct automaton *a, struct channel *ch);
  177. void set_portamento(struct automaton *a, struct channel *ch);
  178. void set_portaslide(struct automaton *a, struct channel *ch);
  179. void set_vibratoslide(struct automaton *a, struct channel *ch);
  180. void set_speed(struct automaton *a, struct channel *ch);
  181. void set_skip(struct automaton *a, struct channel *ch);
  182. void set_fastskip(struct automaton *a, struct channel *ch);
  183. void set_offset(struct automaton *a, struct channel *ch);
  184. void set_volume(struct automaton *a, struct channel *ch);
  185. void parse_slidevol(struct channel *ch, int para);
  186. void init_effects(void (*table[])());
  187.  
  188. /* dump_song.c */
  189. void dump_song(struct song *song);
  190.  
  191. /* getopt.c */
  192. int getopt(int argc, char *argv[], struct long_option *options);
  193.  
  194. /* macintosh_audio.c */
  195. void      set_mix(int percent);
  196. int       open_audio(int SampleRate, int StereoFlag);
  197. void      actually_flush_buffer(void);
  198. void      flush_buffer(int threshhold);
  199. void      close_audio(void);
  200. void      set_synchro(int s);
  201. int       update_frequency(void);
  202. void      discard_buffer(void);
  203. void      resample(struct channel *chan, int oversample, int number);
  204. BOOL      is_channel_full(void);
  205. BOOL            is_channel_empty(void);
  206.  
  207. /* main.c */
  208. void      end_all(void);
  209.  
  210. /* notes.c */
  211. int find_note(int pitch);
  212. void create_notes_table(void);
  213. int transpose_song(struct song *s, int transpose);
  214.  
  215. /* open.c */
  216. FILE *open_file(char *fname, char *mode, char *path);
  217. void close_file(FILE *file);
  218.  
  219. /* player.c */
  220. void init_player(int o, int f);
  221.  
  222. /* read.c */
  223. void release_song(struct song *song);
  224. struct song *read_song(FILE *f, int type);
  225. char *getstring(FILE *f, int len);
  226.  
  227. /* setup_audio.c */
  228. void setup_audio(int f, BOOL s, int o, BOOL sync);
  229. void do_close_audio(void);
  230.  
  231. /* tools.c */
  232. int read_env(char *name, int def);
  233.  
  234. /* termio.c KLUDGES */
  235. BOOL run_in_fg(void);
  236. void sane_tty(void);
  237. void nonblocking_io(void);
  238. void* popen(char* pipe, char* Mode);
  239. void pclose(FILE* file);
  240. int may_getchar(void);
  241.  
  242.  
  243. /* to allow for my own main routine */
  244. #define main main2
  245. int main2(int argc, char **argv);
  246.